<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="author" content="ISUX">
    <meta name="format-detection" content="telephone=no" />
    <meta name="layout" content="main_mobile">
    <meta name="viewport" content="width=device-width,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <link rel="stylesheet" type="text/css" href="../frozen/css/frozen.css">
    <link rel="stylesheet" type="text/css" href="../css/default.css">
    <title>火堆</title>
    <link rel="stylesheet" type="text/css" href="../css/donate_list_2.0.css">
    <style>
        .ui-module-bottom {
            margin: 0;
            font-size: 13px;
            color: #666666;
            background-color: #fff;
            font-size: 14px;
            padding: 8px 35px 8px 15px;
        }
        .ui-module-bottom p {
            color: #a89e99;
            display: inline-block;
            font-size: 12px;
            margin-left: 10px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 70%;
            vertical-align: middle;
        }
    </style>
</head>

<body>
    
    <section class="ui-container">
        <div class="donate-match-top">
        <a  href="/scfire/project/fundpooldetail?fundPoolid=${fundpool.id}">
             <div class="ui-fp-hint ui-arrowlink">
                <span class="img-box" style="background-image:url(/scfire/project/imgRead?img=${fundpool.coverPic});float:left;"></span>
                  ${fundpool.name}
            </div>
            </a>
            <%--<div class="ui-fp-hint">
                <span class="img-box" style="background-image:url(/scfire/project/imgRead?img=${fundpool.coverPic});"></span>
                ${fundpool.name} 
            </div>
            <p> ${fundpool.description} </p>
            --%><ul class="ui-tiled ui-info-tiled ui-border-tb">
                <li>
                    <div class="num"><em>${fRuler?.regular}</em></div>
                    <div>配捐比例</div>
                </li>
                <li>
                    <div class="num"><em><g:formatNumber number="${fRuler.donatefund/100}" format="0.00"/></em> 元</div>
                    <div>已配捐</div>
                </li>
                <li>
                    <div class="num"><em> <g:formatNumber number="${fRuler.bandfund/100- fRuler.donatefund/100}" format="0.00"/></em>元</div>
                    <div>配捐余额</div>
                </li>
            </ul>
            
             <div class="ui-module-bottom ui-arrowlink"  onclick="window.location.href='/scfire/project/projectDetail?projectid=${project.id}'">
                	配捐项目
                <p style=" font-size: 14px;margin-top:-3px;"><em>${project.name }</em></p>
            </div>
        </div>

        <div class="ui-card-module ui-border-tb" >
            <h4 class="ui-border-b">配捐记录（${totalCount}）</h4>
            <ul class="donate-match-list ui-list ui-list-text ui-border-tb" id="fundpools">
                <%--<g:each in="${fDonates}" var="${fDonate}">
                <li class="ui-border-t">
                    <h4>助力${ fDonate?.member.nickname} <em>${fDonate.donate_fee}</em>元</h4>
                    <div class="ui-txt-info"><g:formatDate format="MM-dd HH:mm" date="${fDonate.date}"/> </div>
                </li>
                </g:each>
                 --%>
            </ul>
            
        </div>
		<li id="remove">
       		 <div class="ui-line more"  ><p  id='week'>加载完成</p></div>
       	   </li>
<%--        <div class="banner-wrap">--%>
<%--             <div class="txt-bottom">--%>
<%--            <a href="http://mp.weixin.qq.com/mp/homepage?__biz=MzAxNjM5NzExOQ==&hid=3&sn=e498fbdd2e826943340c0729061ac868#wechat_redirect">了解火堆</a>--%>
<%--            <a href="/scfire/project/qrcode">关注火堆</a><img src="../images/ic-qrcode.png" alt="">--%>
<%--            </div>--%>
<%--            <img class="img-bottom" src="../images/logo_and_txt.png" alt="" class="ui-introduction">--%>
<%--        </div>--%>
    </section>

    <script src="../frozen/lib/zeptojs/zepto.min.js"></script>
    <script src="../frozen/js/frozen.js"></script>
    <script>
    var finalOffset=20
	var offset = 0
	function IsPC() 
 	{ 
 	var userAgentInfo = navigator.userAgent; 
 	var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"); 
 	var flag = true; 
 	for (var v = 0; v < Agents.length; v++) { 
 	if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } 
 	} 
 	return flag; 
 	}

 	var flag = IsPC();
 	if(flag==true){
 	 	var href ="/scfire/project/fundpooldetailPC?fundPoolid=${fundpool.id}";
		$(".donate-match-top a").attr("href",href);  
		$(".ui-arrowlink").attr("onclick","window.location.href='/scfire/project/projectDetailPC?projectid=${project.id}'");
 	 	}

	
	ajaxRead();
      
    function ajaxRead()  
    {  
	    
    	//offset +=finalOffset
        var html="";  
        $.ajax({  
              type:'get',  
              dataType:'json',
	          url:'/scfire/project/donatematchDetail2?format=json&offset='+offset+"&fundPoolid="+${fundPoolid}+"&projectid="+${project.id},  
              beforeSend:function(){console.log('loading...');$("#week").html('加载中...');},  
              success:function(data){
	              			
            	  			$.each(data,function(i,item){
            	  				offset++
            	  				 html += "<li class='ui-border-t'>"
            	  				 html += " <h4>助力 "+ csubstr(item.nickname,6) +" <em>"+(item.donate_fee/100).toFixed(2)+"</em>元</h4>"
           	  					 html += " <div class='ui-txt-info'>"+item.date+"</div>"
           	  				     html += "</li>"
                            });
                            $("#fundpools").append(html);

            	  			if(data.length<finalOffset){       				
	              				$("#week").html("已经到底了")
	              				$("#week").removeAttr("onclick");
	              				
		              		}else{
		              			
	            	            $("#week").html("加载更多")
	            	            $("#week").attr("onclick","ajaxRead()");
			              		}
              },  
              complete:function(){console.log('mission complete.')}  ,
              error:function(data){
	              console.log("error")
            	  $("#week").html('已经到底了');
              }
  
        });  
    }  

    function csubstr(str,len){
    	 if(str.length>7){
        	
    	  return str.substring(0,len)+"...";
    	 }else{
    	  return str;
    	 }
    	}
    
    </script>
</body>

</html>
